
let mongoose = require('mongoose');
module.exports=function (done) {
	let Schema=mongoose.Schema;
	let ObjectId=Schema.Types.ObjectId;
	const User=new Schema({
		author: {type: ObjectId,index: true},//作者
		title: {type: String,trim: true},//字符串
		content: String,
		tags: [{type: String,index: true}],
		createAt: {type: Date,index: true,default:Date.now},
		updateAt: {type: Date,index: true},
		lastCommentedAt: {type: Date,index: true,default:Date.now},
		comments: [
			{
				cid: ObjectId,
				author: ObjectId,
				content: String,
				createAt:{type:Date,default:Date.now}
			}
		]
		
	});
	$.model.Topic=$.mongodb.model('Topic',User);
	done();
}